<!-- 富文本 -->
<form>
    <input type="hidden" name="model_id" value="2" />
<h2 class="attr-title">富文本</h2>
<div class="layui-form-item">
    <label class="layui-form-label sm">背景颜色</label>
    <div class="layui-input-block">
        <div class="color-wrapper">
            <input data-js="color" type="text" name="back_color" value="{$config_info.back_color|default=''}" />
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">上边距</label>
    <div class="layui-input-block">
        <div class="range-wrapper">
            <input type="range" name="padding_top" value="{$config_info.padding_top|default='0'}" onchange="$(this).next().text($(this).val())">
            <span>{$config_info.padding_top|default='0'}</span>
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">下边距</label>
    <div class="layui-input-block">
        <div class="range-wrapper">
            <input type="range" name="padding_bottom" value="{$config_info.padding_bottom|default='0'}" onchange="$(this).next().text($(this).val())">
            <span>{$config_info.padding_bottom|default='0'}</span>
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">文本宽度</label>
    <div class="layui-input-block">
        <input type="text" name="model_width" value="{$config_info.model_width|default=''}" placeholder="请输入文本宽度" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">文本高度</label>
    <div class="layui-input-block">
        <input type="text" name="model_height" value="{$config_info.model_height|default=''}" placeholder="请输入文本高度" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">文本内容</label>
    <div class="layui-input-block">
        <textarea name="editor_content" id="editor_content" style="width:100%;">{if isset($config_info.editor_content)}{$config_info.editor_content|raw}{/if}</textarea>
        <div class="uploader-wrapper">
            <div>
                <div class="uploader-icon iconfont">&#xe6bf;</div>
                <div class="uploader-text">图片上传</div>
                <input type='file' class='uploader-file' onchange='uploadFile($(this),insertEditorImage)'>
            </div>
            
        </div>
    </div>
</div>
</form>
<script>
    if(typeof(loadConfig2)=='undefined'){
    function loadConfig2(obj){
        obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
        obj.find('#editor_content').attr('id','editor_content_'+obj.attr('data-id'))
        ue['i_'+obj.attr('data-id')]=UE.getEditor('editor_content_'+obj.attr('data-id'),{toolbars:[[   
           'fullscreen', 'source', '|', 'undo', 'redo', '|',   
           'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',   
           'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',   
           'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',   
           'directionalityltr', 'directionalityrtl', 'indent', '|',   
           'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',   
           'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',   
           'emotion',  'map', 'gmap',  'insertcode', 'template',  '|',   
           'horizontal', 'date', 'time', 'spechars', '|',   
           'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',   
           'searchreplace', 'help', 'drafts', 'charts'
       ]]})
       ue['i_'+obj.attr('data-id')].addListener('blur',function(editor){
           obj.find('[name="editor_content"]').val(ue['i_'+obj.attr('data-id')].getContent())
           obj.find('form').change()
       });
    }
    }
    if(typeof(insertEditorImage)=='undefined'){
        function insertEditorImage(src,obj){
            ue['i_'+obj.parents('[data-type="config"]').attr('data-id')].execCommand('insertimage', {src:src});
        }
    }
</script>